//
//  UILabel+Extension.swift
//  SinaWeiBo20
//
//  Created by tarena on 16/3/24.
//  Copyright © 2016年 tarena. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(title: String ,fontSize: CGFloat, color: UIColor, margin: CGFloat = 0){
        self.init()
        text = title
        textAlignment = NSTextAlignment.Center
        font = UIFont.systemFontOfSize(fontSize)
        textColor = color
        numberOfLines = 0
        
        if margin > 0 {
            //设置最大显示的宽度
            preferredMaxLayoutWidth = screenW - 2 * margin
            textAlignment = .Left
        }
        sizeToFit()
    }
    
    
}
